<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%><!DOCTYPE HTML>
<%-- <%@include file="edit.jsp"%> --%>
<html>
<head>
<script type="text/javascript">
	$(function() {
		$('#enabled').radiobox({name:'entity.enabled',value:true,data:[[true,'有效'],[false,'无效']]});
		$('#iUserType').combobox({
		    data:$codelist('userType'),editable:false,width:180
		});
		$('#toolbar').toolbar({buttons:[
			{name:'save',iconCls:'icon-save',text:'保存'}
	  	],handler:handler});
	});
	function handler() {
		switch(this.name) {
			case 'save': toSave();break;
		}
	}
	function toSave(){
		$.messager.progress({title:'系统提示',text:'数据处理中，请耐心等待...'});
		$.submit('#dataform',function(r) {
			$.messager.progress('close');
			if(r.code<0) return $alert(r.msg);
			top.$prompt('保存成功');
			top.$window.close(window,1,null);
		});
	}
	
	//添加界面的附件管理
	function toDeploy(){
		showUpload({title:'上传封面'
			,options:{
				filters:{
					mime_types: [{title : "封面图片", extensions : "jpg,png"}]
				},
				multi_selection: false ,
				 init:{
					 FileUploaded:function(uploader,file,responseObject){
						 var response = responseObject.response;
						 var json = eval('(' + response + ')');
						 var data = json.data;
						 var path = data.fileUrl;
						 console.log(data);
						 console.log(data.id);
						 $("#input_headurl").val(data.fileUrl);  //完成后更新已上传的文件列表
						 showImg(path);
					 }
				},
				complete:function(){
					top.$ok('上传成功');
				}
			}
		});
	}
	function showImg(path){
		var html = '<img src="'+path+'" style="width:80px;heigth:80px;">';
		$("#show_head").html(html);
	}
	
</script>
</head>
<body>
	<div id="toolbar" class="toolbar" ></div>
	<div class="easyui-layout" data-options="fit:true">
		<div data-options="region:'center',border:false">
			<form id="dataform" action="add" method="post">
				<input type="hidden" name="entity.id" value="${item.id }" />
				<table class="form-tbl">
					<tr class="form-tr">
						<th class="form-th">积分项目:</th>
						<td class="form-td">
							<input type="text" name="entity.score" value="${item.score }" class="form-text" style="width:170px;" />
						</td>
					</tr>
					<tr class="form-tr">
						<th class="form-th">类型:</th>
						<td class="form-td">
							 <select class="easyui-combobox" name="entity.operationType">
								<option value="1">新手任务</option>
								<option value="3">每日任务</option>	
								<option value="5">成就加分</option>						
							</select>
						</td>
					</tr>
					<tr class="form-tr">
						<th class="form-th">得分:</th>
						<td class="form-td">
							<input type="text" name="entity.score" value="${item.score }" class="form-text" style="width:170px;" />
						</td>
					</tr>
					<tr class="form-tr">
						<th class="form-th">上限:</th>
						<td class="form-td">
							<input type="text" name="entity.scoreCount" value="${item.scoreCount }" class="form-text" style="width:170px;" />
							次/天
						</td>
					</tr>
					<tr class="form-tr">
						<th class="form-th">操作路径:</th>
						<td class="form-td">
							<input class="easyui-textbox" name="entity.operationUrl" value="${item.operationUrl }" style="width:100%;" />
						</td>
					</tr>
					<tr class="form-tr">
						<th class="form-th">积分规则:</th>
						<td class="form-td">
							 <input class="easyui-textbox" name="entity.operationDesc" value="${item.operationDesc }" style="width:100%;height:100px" data-options="multiline:true">
						</td>
					</tr>
					<tr class="form-tr">
						<td id="show_head" class="form-td" colspan="2">
						</td>
					</tr>
				</table>
			</form>
		</div>
	</div>
</body>
</html>